package cn.labbook.bluetooth.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.Date;
import java.util.Objects;

/**
 * @Author: zhangyang
 * @Date: 2023/4/13 13:37
 * @Desc: 申请记录
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class ApplyRecord implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 申请用户openId
     */
    private String openId;
    /**
     * 电表id
     */
    private String ammeterId;
    /**
     * 电表地址
     */
    private String location;


    /**
     * 申请金额
     */
    private Double amount;
    /**
     * 冲入电表金额
     */
    private Double payTrueAmount;
    /**
     * 主站平台手续费
     */
    private Double zkisPlatformAmount;

    /**
     * 申请时间
     */
    private Date createTime;
    /**
     * 申请状态
     */
    private Integer status;
    /**
     * 同步状态
     */
    private Integer syncStatus;

    /**
     * 是否向房客收取服务费：1-收取，0-不收取
     */
    private Integer isSkimp;

    /**
     * 类型
     */
    private Integer type;


    public enum Type {

        APPLY(1, "申请记录"),
        PROTECT(2, "保电记录"),

        ;
        private final int key;
        private final String value;

        Type(int key, String value) {
            this.key = key;
            this.value = value;
        }

        public int getKey() {
            return key;
        }

        public String getValue() {
            return value;
        }
    }


    public enum Status {

        IN(1, "申请中"),
        COMPLETE(2, "已完成"),
        BACK(3, "已撤回"),

        ;
        private final int key;
        private final String value;

        public static String getValueByKey(Integer key) {
            for (Status item : Status.values()) {
                if (Objects.equals(item.key, key)) {
                    return item.value;
                }
            }
            return null;
        }

        Status(int key, String value) {
            this.key = key;
            this.value = value;
        }

        public int getKey() {
            return key;
        }

        public String getValue() {
            return value;
        }
    }

    public enum SyncStatus {

        WAIT(1, "待同步"),
        ALREADY(2, "已同步"),

        ;
        private final int key;
        private final String value;

        SyncStatus(int key, String value) {
            this.key = key;
            this.value = value;
        }

        public int getKey() {
            return key;
        }

        public String getValue() {
            return value;
        }
    }

}
